package top.hiai.service;

import java.util.List;

import com.jfinal.plugin.activerecord.Page;

import top.hiai.model.ArcType;

/**
* @Author www.hiai.top
* @Email  goodsking@163.com
* @Message 更多资源尽在www.hiai.top,开发者：黄康权
* @Introduction 类的介绍
*/

public class ArcTypeService {

	private  ArcType dao = new ArcType().dao();
	
    /**
     * 获取所有的文章分类，用户前台分类检索
     * @return
     */
    public List<ArcType> getArcTypeList() {
        return dao.find(" SELECT * FROM t_arctype ORDER BY sort ASC ");
    }
    
	/**
	 * 网站后台获取所有分类，可以分页显示
	 * @param pageNumber
	 * @param pageSize
	 * @return
	 */
	public Page<ArcType> paginate(int pageNumber, int pageSize) {
		return dao.paginate(pageNumber, pageSize, "select * ", "from  t_arctype order by sort ASC");
	}
    /**
     * 删除分类
     * @param tid
     */
    public void deleteById(int tid) {
        dao.deleteById(tid);
    }
    /**
     * 根据文章的ID获取分类
     * @param uid
     * @return
     */
	public ArcType findById(int tid) {
		return dao.findById(tid);
	}
}
